<?php $this->load->view('admin/_header1') ?>
<script language="javascript" type="text/javascript" src="<?=site_url("Phome/get_lang")?>"></script>
<script language=javascript src="<?=site_url('js/policy.js');?>"></script>
<script language=javascript src="<?=site_url('js/validator.js');?>"></script>
<?php
echo form_open("admin/Airlines/saveFlight",array("onsubmit" =>"return Checkairpolicy_1(this)"));
echo form_hidden("cmd",$cmd);
echo form_hidden("FlightCode",$FlightCode);
echo form_hidden("FlightID",$FlightID);
?>
<div class="dvfbody2" style="border:0px">
	<table  width=100% border=0>
		<tr height=45 valign=top>
			<td colspan=2 width=290 style="font-weight:bold;font-size:14px"><?=$title?></td>
		</tr>
		<tr height=25>
			<td colspan=2 width=290 style="font-weight:bold;">Flight Setting</td>
		</tr>
		<tr height=25px>
			<td width=100% colspan=2>Segment: From <input type=text name="FromPort" value="" maxlength=3 verify="M" desc="Fromport"  class="txairc"  style="width:30px"/>
				(stop:<input type=text name="StopPort[]" maxlength=3   class="txairc"  style="width:30px"/>/
				<input type=text name="StopPort[]" maxlength=3   class="txairc"  style="width:30px"/>/
				<input type=text name="StopPort[]" maxlength=3   class="txairc"  style="width:30px"/>)
				&nbsp;To <input type=text name="DestPort" maxlength=3 verify="M" desc="Destport"  class="txairc"  style="width:30px"/>
		</tr>
		<tr height=25>
			<td width=100% colspan=2>Flight Date:  <input type=text name="FlightDate1" verify="M" desc="FlightDate" value="" class="txdatec"  style="width:80px" /> To <input type=text name="FlightDate2" verify="M" desc="FlightDate" value="" class="txdatec"  style="width:80px" />
		</tr>
		<tr height=25>
			<td width=100% colspan=2>Week Available: <input type=checkbox name="WeekAvailable[]" value=1 >Mon
			<input type=checkbox name="WeekAvailable[]" value=2 >Tue
			<input type=checkbox name="WeekAvailable[]" value=3 >Wed
			<input type=checkbox name="WeekAvailable[]" value=4 >Thu
			<input type=checkbox name="WeekAvailable[]" value=5 >Fri
			<input type=checkbox name="WeekAvailable[]" value=6 >Sat
			<input type=checkbox name="WeekAvailable[]" value=7 >Sun
			</td>
		</tr>
		<tr height=25>
			<td width=90 ></td><td></td>
		</tr>
		
		<tr height=25>
			<td width=100% colspan=2>Flight Time: <input type=text name="Time1" maxlength=8 value="" class="txairc"  style="width:60px" /> To <input type=text name="Time2" maxlength=8  value=""  class="txairc"  style="width:60px" /></td>
		</tr>
		
		<tr height=25>
			<td width=100% colspan=2>Flight Number: <input type=text name="FlightNumber" maxlength=10 value="" class="txairc"  style="width:80px" /> </td>
		</tr>
		
		<tr height=25>
			<td width=90 ></td>
			<td></td>
		</tr>
				
		<tr height=25>
			<td width=100% colspan=2 >Execute plane number: <input type=text readonly name="Planecode" id="Planecode" value="" class="txairc"  style="width:100px" /> 
				<a href="/public/pop/pop_select_plane.asp?code=PlaneCode&name=PlaneModel&TotalF=TotalF&TotalC=TotalC&TotalY=TotalY" target="blank_">(select)</a></td>
		</tr>
		
		<tr height=25>
			<td width=100% colspan=2 >Plane model code: <input type=text readonly name="PlaneModel" id="PlaneModel" maxlength=14 value="" class="txairc"  style="width:100px" /> </td>
		</tr>
		
		<tr height=25>
			<td width=100% colspan=2 >Total Class: <input type=text readonly name="TotalF" id="TotalF" maxlength=6  value="" class="txairc"  style="width:60px" /> /
				<input type=text readonly name="TotalC" id="TotalC" maxlength=6  value="" class="txairc"  style="width:60px" /> /
				<input type=text readonly name="TotalY" id="TotalY" maxlength=6  value="" class="txairc"  style="width:60px" /> </td>
		</tr>
		
		<tr height=25>
			<td width=100% colspan=2 >Available Class: <input type=text name="AvbF" maxlength=6  value="" class="txairc"  style="width:60px" /> /
				<input type=text name="AvbC" maxlength=6  value="" class="txairc"  style="width:60px" /> /
				<input type=text name="AvbY" maxlength=6  value="" class="txairc"  style="width:60px" /> </td>
		</tr>
			
		<tr height=25>
			<td width=90 ></td>
			<td></td>
		</tr>
		
		<tr height=25>
			<td colspan=2 width=290 style="font-weight:bold;">Class setting </td>
		</tr>
		
		<tr height=25>
			<td width=100% colspan=2 >
				 <TABLE  border=1 cellspacing=0 cellpadding=0 align=left
				 width=100% id="tbPessenger_1">
				 <tr>
				  <td width=80 align=center>Class Code</td>
				  <td width=55 align=center >Type</td>
				  <td width=80 align=center>Class Type</td>
				  <td width=70 align=center>Amount</td>
				  <td width=265 align=center>Note</td>
				  <td width=50 align=center><Input type=button value="ADD" class="button" onclick="return addFlightClass(++iMaxI);"></td>
				 </tr>
				</table>
				<table style="display:none;"  id="tbModel_1">
				 <tr >
				  <td width=80 >
				  	<input type=text name="Classcode" ID=Classcode_REPLACE_INDEX class="txairc" value="" style="width:76px;cursor:hand" readonly onclick="window.open('Flights/addClass','supplierSel','width=800px,height=600px,status=no');" title="Select Class">
				  </td>
				  <td width=55 ><input class=txairc style="width:51px" type=text name=ClassType1 ID=ClassType1_REPLACE_INDEX value=""></td>
				  <td width=80 ><input class=txairc style="width:76px" type=text name=ClassType2 ID=ClassType2_REPLACE_INDEX value=""></td>
				  <td width=70 ><input class=txairc style="width:66px" type=text name=abvAmount ID=abvAmount_REPLACE_INDEX value=""></td>
				  <td width=265 ><input class=txairc style="width:261px" type=text name=Note ID=Note_REPLACE_INDEX value=""></td>
				  <td width=50 align=center><input type=button name=BUT value="DEL" class="button" id=delete_REPLACE_INDEX onclick="return deletethisrow(this);">
				  <input type=hidden name=ClassID ID=ClassID_REPLACE_INDEX value="" ><input type=hidden name=Changerule ID=Changerule_REPLACE_INDEX value="" ><input type=hidden name=Refundrule ID=Refundrule_REPLACE_INDEX value="" ><input type=hidden name=Rule ID=Rule_REPLACE_INDEX value="" ></td>
				 </tr>
				</table>
			</td>			
		</tr>
		
		<tr height=25>
			<td width=100% colspan=2 ></td>
		</tr>
		<tr height=25>
			<td width=100% colspan=2 >Initial Status: <%
				%><select name="Status"  class="txa" value=""><%
				%><option value="">==SELECT==</option><%
				For i=0 To UBound(ARRAY_PLANESTATUS)
					%><option <%
					%> value="<%=i%>"><%=ARRAY_PLANESTATUS(i)%></option><%
				Next
				%></select><%
			%></td>
		</tr>
		<tr height=25>
			<td width=100% colspan=2 ></td>
		</tr>				
		<tr height=25>
			<td width=90 ><input type="submit" name="bbb" value="Add Flight" class="button" /></td>
			<td></td>
		</tr>	
	</table>
</div>

<?php
echo form_close();
?>


<script language=javascript>
var iMaxI;
iMaxI = 0;
	
function addFlightClass(iMaxI){
	
	
	addmodelbyIndex(1,iMaxI);

 	return false;
}

function deletethisrow(obj){
	obj.parentNode.parentNode.parentNode.deleteRow(obj.parentNode.parentNode.rowIndex);
	return false;
}

function addmodelbyIndex(index,iMaxI){
	var objtb	=gd$("tbPessenger_"+index);
	var objtbM=gd$("tbModel_"+index);
	var newtr=objtb.insertRow(-1);
	var rowlength=objtb.rows[0].cells.length;
	newtr.align="center";
	for(var i=0;i<rowlength;i++){
		var td=newtr.insertCell(-1);
		var html=objtbM.rows[0].cells[i].innerHTML;
		html=html.replace(/REPLACE_INDEX/g,iMaxI);
		td.innerHTML=html;
	}
}

function gd$(fctId){
        return document.getElementById(fctId);
}

$(document).ready(function(){
	$('.txdatec').datepick({monthsToShow:2});
});


</script>
<?php $this->load->view('admin/_footer1') ?>